﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Dazzle {
    public partial class Form1 : Form, IOleInPlaceUIWindow {
        ILog logger = LogManager.GetLogger(typeof(Form1));

        public Form1() {
            InitializeComponent();
        }

        #region IOleInPlaceUIWindow Members

        public int GetWindow(ref IntPtr phwnd) {
            logger.Debug("Form1.GetWindow");

            phwnd = this.Handle;

            return Win32.S_OK;
        }

        public int ContextSensitiveHelp(bool fEnterMode) {
            logger.Debug("Form1.ContextSensitiveHelp({0})", fEnterMode);
            return Win32.S_OK;
        }

        public int GetBorder(ref Win32.RECT lprectBorder) {
            logger.Debug("Form1.GetBorder()");

            lprectBorder.Left = this.Left;
            lprectBorder.Right = Right;
            lprectBorder.Top = Top;
            lprectBorder.Bottom = Bottom;

            
            return Win32.S_OK;
        }

        public int RequestBorderSpace(ref Win32.RECT pborderwidths) {
            throw new NotImplementedException();
        }

        public int SetBorderSpace(ref Win32.RECT pborderwidths) {
            throw new NotImplementedException();
        }

        public int SetActiveObject(ref IOleInPlaceActiveObject pActiveObject, string pszObjName) {
            logger.Debug("Form1.SetActiveObject({0})", pActiveObject is GraphBox);

            return pActiveObject is GraphBox ? 1:0;
        }

        #endregion
    }
}
